<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<c:url value='/css/style.css'/>" rel="stylesheet"
	type="text/css" />
<fmt:setBundle basename="messages" />
<title>CompleteLeaveDetail</title>
</head>
<body>
<%@ include file="Header.jsp"%>
		<table cellspacing="2" cellpadding="1" border="1" align="center" width="100%">
		<tr>
			<td width="300px" style="vertical-align: top"><%@ include file="Menu.jsp"%></td>
			<td>
	<h3>COMPLETE LEAVE DETAIL</h3>
	<form action="editleave" method="get">
		<input type="hidden" name="leaveid" value="${empleave.leaveId}" />
		<c:if test="${error }">
			<font color="red">***Please write a comment for rejection***</font>
		</c:if>

		<table>
			<tr>
				<th align="left">Leave Id:</th>
				<td>${empleave.leaveId}</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th align="left">Employee Name:</th>
				<td>${empleave.employeeName}</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th align="left">Leave Type:</th>
				<td>${empleave.leaveType}</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th align="left">From Date:</th>
				<td>${empleave.leaveStartDate}</td>
				<th align="left">To Date:</th>
				<td>${empleave.leaveEndDate}</td>
			</tr>
			<tr>
				<th align="left">Reason:</th>
				<td>${empleave.leaveReason}</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th align="left">Status:</th>
				<td>${empleave.status}</td>
				<th align="left">Number of Leaves taken:</th>
				<td>${empleave.remainingLeaves}</td>
			</tr>
		</table>

		<p>

			<c:if test="${empty mgr}">
				<c:if test="${empty readonly}">
					<c:if
						test="${empleave.status=='Applied' or empleave.status=='Updated'}">
						<button type="submit" name="button" value="Updated">Update</button>
						<button type="submit" name="button" value="Deleted">Delete</button>
					</c:if>
					<c:if test="${empleave.status=='Approved'}">
						<button type="submit" name="button" value="Cancelled">Cancel</button>
					</c:if>
				</c:if>
			</c:if>
	</form>
	<c:if test='${mgr}'>
		<p>
			<c:import url="/Approval.jsp">
				<c:param name="leaveid" value="${empleave.leaveId}" />
			</c:import>
		<p>
		<h3>LEAVES ON SAME PERIOD</h3>
		<c:choose>
			<c:when test="${not empty leavesonsameperiod}">
				<table width="100%" cellspacing="2" cellpadding="2" border="1">
					<tr>
						<th>Reference</th>
						<th>Employee Id</th>
						<th>Employee Name</th>
						<th>Leave Type</th>
						<th>From Date</th>
						<th>To Date</th>
						<th>Status</th>
					</tr>

					<c:forEach var="leaverecords" items="${leavesonsameperiod}"
						varStatus="status">
						<tr class="${status.index%2==0?'even':'odd'}">

							<td class=nowrap><c:out value="${leaverecords.leaveId}" />
							</td>
							<td class=nowrap><c:out value="${leaverecords.employeeId}" />
							</td>
							<td class=nowrap><c:out value="${leaverecords.employeeName}" />
							</td>
							<td class=nowrap><c:out value="${leaverecords.leaveType}" />
							</td>
							<td class=nowrap><c:out
									value="${leaverecords.leaveStartDate}" /></td>
							<td class=nowrap><c:out value="${leaverecords.leaveEndDate}" />
							</td>
							<td class=nowrap><c:out value="${leaverecords.status}" /></td>

						</tr>
					</c:forEach>

				</table>
			</c:when>
			<c:otherwise>
	no record is found
	</c:otherwise>
		</c:choose>
	</c:if>
	<p>
	<h3>History</h3>
	<c:choose>
		<c:when test="${not empty empleave.createdBy }">
			<table width="100%" cellspacing="2" cellpadding="2" border="1">

				<tr>
					<th>Date</th>
					<th>Action Taken</th>
					<th>By</th>
					<th>Comment</th>
				</tr>
				<tr>
					<td class="nowrap"><c:out value="${empleave.createdOn}" />
					</td>
					<td class="nowrap">Applied</td>
					<td class="nowrap"><c:out value="${empleave.createdBy}" />
					</td>
					<td class="nowrap"><c:out value="${empleave.leaveReason}" />
					</td>
				</tr>
				<c:if test="${not empty empleave.modifiedBy}">
					<tr>
						<td><c:out value="${empleave.modifiedOn}" />
						</td>
						<td><c:out value="${empleave.status}" />
						</td>
						<td><c:out value="${empleave.modifiedBy}" />
						</td>
						<td><c:out value="${empleave.remarks}" />
						</td>
					</tr>
				</c:if>
			</table>
		</c:when>
		<c:otherwise>
	no record is found
	</c:otherwise>
	</c:choose>
</td>
</tr>
</table>
</body>
</html>